﻿//--------------------------------------------------------------------------
// 
//  Copyright (c) Chili Software.  All rights reserved. 
// 
//  File: OECommand.cs
//
//  Description: Command for the ObjectExpression.
// 
//--------------------------------------------------------------------------

using System;
using System.Collections.Generic;

namespace Chili.Opf3.Query.OPathParser
{
	/// <summary>
	/// Represents a custom command in the OPath statement. 
	/// </summary>
	/// <remarks>
	/// Custom commands in a OPath statement are converted to this class when OPath is compiled.
	/// Those commands are then converted to a command that can be executed on the storage.
	/// Look at the documentation of the <see cref="Opf3.Query.ObjectQuery{T}">ObjectQuery</see>
	/// class for further information about custom commands.
	/// </remarks>
	[Serializable]
	public sealed class OECommand : OEItem
	{
		private string _name;
		private IList<string> _arguments = new List<string>();

		/// <summary>
		/// Creates a new instance of the <see cref="OECommand">OECommand Class</see>.
		/// </summary>
		/// <param name="name">Name of the command.</param>
		internal OECommand(string name)
		{
			_name = name;
		}

		/// <summary>
		/// Returns the name of the command.
		/// </summary>
		/// <value>The name of the custom command.</value>
		public string Name
		{
			get { return _name; }
		}

		/// <summary>
		/// A list that contains the arguments of the command. A command can also contain commands.
		/// For example: SubString(UserName, 1, 3) contains two arguments: 1 and 3.
		/// </summary>
		/// <value></value>
		public IList<string> Arguments
		{
			get { return _arguments; }
		}
	}
}
